# !/usr/bin python3                                
# encoding: utf-8 -*-
# @file: cloud_1136_test.py                       
# @author   : wjd
# @Time: 2024/1/4 17:23

# (22,173.38-22178.28-(0-0))/22178.28*100

import decimal


class Cloud_1136():
    def zichan_jisuan(self, dangqian, chushi, huaru, huachu):
        """
        资产计算
        :param dangqian: mpc+借贷+债=当前资产
        :param chushi: 定时任务在数据插入的数值
        :param huaru: 充值的所有币种
        :param huachu: 提币的所有币种
        净划入资产=充值的和提币的币种，先相互加减计算，剩余的多币种数量，折算成USDT的总额
        :return:
        """
        sum1 = decimal.Decimal(str(dangqian)) - decimal.Decimal(str(chushi)) - (decimal.Decimal(str(huaru)) - decimal.Decimal(str(huachu)))  # 估值日变量
        sum = sum1 / decimal.Decimal(str(chushi))  # 估值日变量比
        sum = sum * 100
        result_3 = format(sum, ".3f")
        result_2 = format(sum, ".2f")
        # a = str(sum).split('.')[0] + '.' + str(sum).split('.')[1][:2]
        print("估值日变量：{}".format(sum1))
        print("估值日变量比_3位：{}%".format(result_3))
        print("估值日变量比_2位：{}%".format(result_2))


if __name__ == '__main__':
    Cloud_1136().zichan_jisuan(dangqian=22382.7, chushi=23513.43, huaru=0, huachu=0)
    print("*" * 100)
    Cloud_1136().zichan_jisuan(dangqian=323802.24, chushi=318730.32, huaru=0.53, huachu=0)
